package cn.shop.cloud.service.impl;


import cn.shop.cloud.domain.SeckillOrder;
import cn.shop.cloud.mapper.SeckillOrderMapper;
import cn.shop.cloud.service.ISeckillOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: work
 * @ClassName SeckillOrderServiceImpl
 * @description:
 * @author: 李尧坤
 * @create: 2025−01-09 19:46
 * @Version 1.0
 **/
@Service
public class SeckillOrderServiceImpl implements ISeckillOrderService {

    @Autowired
    private SeckillOrderMapper seckillOrderMapper;

    @Override
    public SeckillOrder findUserIdAndSeckillId(Long userId, Long seckillId) {
        return seckillOrderMapper.findUserIdAndSeckillId(userId,seckillId);
    }

    @Override
    public void createSeckillOrder(Long userId, Long seckillId, String orderNo) {
        SeckillOrder so = new SeckillOrder();
        so.setOrderNo(orderNo);
        so.setSeckillId(seckillId);
        so.setUserId(userId);
        //添加数据库中
        seckillOrderMapper.insert(so);
    }
}
